public class Game extends Panel {
Box puck = new Box(puckColor);
Game() {
MouseMotionListener movePuck =
new MouseMotionAdapter() {
public void mouseMoved(MouseEvent e) {
int x = e.getX();
int y = getSize().height -
puck.getSize().height;
puck.setLocation(x, y);
}
};
addMouseMotionListener(movePuck);
}
}
|